<div class="blazorise-codeblock">
<div class="html"><pre>
<span class="htmlTagDelimiter">&lt;</span><span class="htmlElementName">Pagination</span><span class="htmlTagDelimiter">&gt;</span>
    <span class="htmlTagDelimiter">&lt;</span><span class="htmlElementName">PaginationItem</span> <span class="htmlAttributeName">Disabled</span><span class="htmlOperator">=</span><span class="quot">&quot;</span><span class="htmlAttributeValue"><span class="atSign">&#64;</span>IsPageNavigationDisabled(PREVIOUS)</span><span class="quot">&quot;</span> <span class="htmlAttributeName"><span class="atSign">&#64;</span>onclick</span><span class="htmlOperator">=</span><span class="quot">&quot;</span><span class="htmlAttributeValue">Previous</span><span class="quot">&quot;</span><span class="htmlTagDelimiter">&gt;</span>
        <span class="htmlTagDelimiter">&lt;</span><span class="htmlElementName">PaginationLink</span><span class="htmlTagDelimiter">&gt;</span>
            <span class="htmlTagDelimiter">&lt;</span><span class="htmlElementName">span</span> <span class="htmlAttributeName">aria-hidden</span><span class="htmlOperator">=</span><span class="quot">&quot;</span><span class="keyword">true</span><span class="quot">&quot;</span><span class="htmlTagDelimiter">&gt;</span>&#171;<span class="htmlTagDelimiter">&lt;/</span><span class="htmlElementName">span</span><span class="htmlTagDelimiter">&gt;</span>
        <span class="htmlTagDelimiter">&lt;/</span><span class="htmlElementName">PaginationLink</span><span class="htmlTagDelimiter">&gt;</span>
    <span class="htmlTagDelimiter">&lt;/</span><span class="htmlElementName">PaginationItem</span><span class="htmlTagDelimiter">&gt;</span>
    <span class="atSign">&#64;</span>{
        for (var i = 1; i &lt;= pageItems; i++)
        {
            var pageNumberAsString = i.ToString();
            <span class="htmlTagDelimiter">&lt;</span><span class="htmlElementName">PaginationItem</span> <span class="htmlAttributeName"><span class="atSign">&#64;</span>key</span><span class="htmlOperator">=</span><span class="quot">&quot;</span><span class="htmlAttributeValue">pageNumberAsString</span><span class="quot">&quot;</span> <span class="htmlAttributeName">Active</span><span class="htmlOperator">=</span><span class="quot">&quot;</span><span class="htmlAttributeValue"><span class="atSign">&#64;</span>IsActive(pageNumberAsString)</span><span class="quot">&quot;</span><span class="htmlTagDelimiter">&gt;</span>
                <span class="htmlTagDelimiter">&lt;</span><span class="htmlElementName">PaginationLink</span> <span class="htmlAttributeName">Page</span><span class="htmlOperator">=</span><span class="quot">&quot;</span><span class="sharpVariable"><span class="atSign">&#64;</span>pageNumberAsString</span><span class="quot">&quot;</span> <span class="htmlAttributeName">Clicked</span><span class="htmlOperator">=</span><span class="quot">&quot;</span><span class="htmlAttributeValue">SetActive</span><span class="quot">&quot;</span><span class="htmlTagDelimiter">&gt;</span>
                    <span class="atSign">&#64;</span>pageNumberAsString
                <span class="htmlTagDelimiter">&lt;/</span><span class="htmlElementName">PaginationLink</span><span class="htmlTagDelimiter">&gt;</span>
            <span class="htmlTagDelimiter">&lt;/</span><span class="htmlElementName">PaginationItem</span><span class="htmlTagDelimiter">&gt;</span>
        } 
    }
    <span class="htmlTagDelimiter">&lt;</span><span class="htmlElementName">PaginationItem</span> <span class="htmlAttributeName">Disabled</span><span class="htmlOperator">=</span><span class="quot">&quot;</span><span class="htmlAttributeValue"><span class="atSign">&#64;</span>IsPageNavigationDisabled(NEXT)</span><span class="quot">&quot;</span> <span class="htmlAttributeName"><span class="atSign">&#64;</span>onclick</span><span class="htmlOperator">=</span><span class="quot">&quot;</span><span class="htmlAttributeValue">Next</span><span class="quot">&quot;</span><span class="htmlTagDelimiter">&gt;</span>
        <span class="htmlTagDelimiter">&lt;</span><span class="htmlElementName">PaginationLink</span><span class="htmlTagDelimiter">&gt;</span>
            <span class="htmlTagDelimiter">&lt;</span><span class="htmlElementName">span</span> <span class="htmlAttributeName">aria-hidden</span><span class="htmlOperator">=</span><span class="quot">&quot;</span><span class="keyword">true</span><span class="quot">&quot;</span><span class="htmlTagDelimiter">&gt;</span>&#187;<span class="htmlTagDelimiter">&lt;/</span><span class="htmlElementName">span</span><span class="htmlTagDelimiter">&gt;</span>
        <span class="htmlTagDelimiter">&lt;/</span><span class="htmlElementName">PaginationLink</span><span class="htmlTagDelimiter">&gt;</span>
    <span class="htmlTagDelimiter">&lt;/</span><span class="htmlElementName">PaginationItem</span><span class="htmlTagDelimiter">&gt;</span>
<span class="htmlTagDelimiter">&lt;/</span><span class="htmlElementName">Pagination</span><span class="htmlTagDelimiter">&gt;</span>
</pre></div>
<div class="csharp"><pre>
<span class="atSign">&#64;</span>code
{
    <span class="keyword">private</span> <span class="keyword">const</span> <span class="keyword">string</span> PREVIOUS = <span class="string">&quot;previous&quot;</span>;
    <span class="keyword">private</span> <span class="keyword">const</span> <span class="keyword">string</span> NEXT = <span class="string">&quot;next&quot;</span>;
    <span class="keyword">private</span> <span class="keyword">string</span> currentPage = <span class="string">&quot;2&quot;</span>;
    <span class="keyword">private</span> <span class="keyword">int</span> pageItems = <span class="number">5</span>;

    <span class="keyword">private</span> <span class="keyword">bool</span> IsActive(<span class="keyword">string</span> page)
        =&gt; currentPage == page;

    <span class="keyword">private</span> <span class="keyword">bool</span> IsPageNavigationDisabled(<span class="keyword">string</span> navigation )
    {
        <span class="keyword">if</span> (navigation.Equals(PREVIOUS))
        {
            <span class="keyword">return</span> currentPage.Equals(<span class="string">&quot;1&quot;</span>);
        }
        <span class="keyword">else</span> <span class="keyword">if</span> (navigation.Equals(NEXT))
        {
            <span class="keyword">return</span> currentPage.Equals(pageItems.ToString());
        }
        <span class="keyword">return</span> <span class="keyword">false</span>;
    }

    <span class="keyword">private</span> <span class="keyword">void</span> Previous()
    {
        <span class="keyword">var</span> currentPageAsInt = <span class="keyword">int</span>.Parse(currentPage);
        <span class="keyword">if</span> (currentPageAsInt &gt; <span class="number">1</span> )
        {
            currentPage = (currentPageAsInt - <span class="number">1</span>).ToString();
        }
    }

    <span class="keyword">private</span> <span class="keyword">void</span> Next()
    {
        <span class="keyword">var</span> currentPageAsInt = <span class="keyword">int</span>.Parse(currentPage);
        <span class="keyword">if</span> (currentPageAsInt &lt; pageItems )
        {
            currentPage = (currentPageAsInt + <span class="number">1</span>).ToString();
        }
    }

    <span class="keyword">private</span> <span class="keyword">void</span> SetActive(<span class="keyword">string</span> page)
        =&gt; currentPage = page;
}
</pre></div>
</div>
